package cn.ai.boot.config.PCF;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author jie.zhao@dms365.com
 * @Date 2025/7/30 11:10
 */
public class Test311 {

    private static String getC(Integer c) {
        if (c > 39) {
            return 39 + "C";
        } else {
            return c + "C";
        }
    }

    public static void main(String[] args) throws IOException {
        PCFProcessor processor = new PCFProcessor("D:\\download\\testpcf\\x\\2170-BDG-122003.pcf");

        List<String> lines = processor.getLines();
        // 2 获取PCF文件，顶部 UNITS-BORE 的值
        String value = processor.getValueByKey("END-POINT");
        System.out.println("提取的值: " + value);

        // 3 判断整个PCF文件中，是否有 FABRICATION-ITEM的标识，如果有替换为ERECTION-ITEM
        processor.replaceAllIdentifiers("    FABRICATION-ITEM", "ERECTION-ITEM");

        // 功能3示例
        List<int[]> ranges = processor.getValueRanges2("{000138A8-0000-0000-6A15-7E0C50672406}");

        processor.updateKeyValueInRange("WELD-ATTRIBUTE3", "WssS", ranges);


        processor.saveToFile();
    }
}
